package source;

import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.common.typeinfo.Types;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.types.LongValue;
import org.apache.flink.util.LongValueSequenceIterator;

/**
 * FromParallelCollection Source
 * 并行化集合创建DataStream 底层都是调用addSource
 */
public class FromParallelCollectionDemo {

    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();

        DataStreamSource<LongValue> data = env.fromParallelCollection(new LongValueSequenceIterator(1L,19L),TypeInformation.of(LongValue.class));

        data.print();

        env.execute("FromParallelCollection Source");
    }
}
